<include file="./VMSTpl/Admin/header.html" />
<div class="container">
  <h2>{$title}</h2>
  <div class="col-md-6">
  <form role="form" method="post" onSubmit="return check();">
    <div class="form-group">
      <label for="no">飞机号码</label>
      <input type="text" class="form-control" value="{$no}" {$readonly} id="no" name="no" placeholder="0001" required>
    </div>
    <div class="form-group">
      <label for="date">出厂日期</label>
      <input type="text" class="form-control" id="date" name="date" placeholder="2000-12-01" required>
    </div>
    <button type="submit" class="btn btn-primary btn-lg btn-block">提交</button>
	<a href="__ROOT__/Admin/Index" class="btn btn-default btn-lg btn-block">返回</a> 
  </form>
  </div>
</div>
<include file="./VMSTpl/Admin/tailer.html" />
<script>
  	$(document).ready(function(){
		$("input[name='date']").cxCalendar({ 
			type:"yyyy-mm-dd",
		}); 
	})
	function check(){
		var no = $("input[name='no']").val();
		var date = $("input[name='date']").val();
		
		var reg=/^\d{4}$/;
		if(!reg.test(no)){
			alert("飞机号码格式有误！");
			$("input[name='no']").focus();
			return false;
		}
		
		reg=/^(?:(?!0000)[0-9]{4}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-8])|(?:0[13-9]|1[0-2])-(?:29|30)|(?:0[13578]|1[02])-31)|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)-02-29)$/;
		if(!reg.test(date)){
			alert("日期格式有误！");
			$("input[name='date']").focus();
			return false;
		}
	}
</script>